import { ILoadMapTypeAll } from '@/common';
import { getLevelZeroJson, getTenantID } from '@/utils';
import { MaterialManageAPI } from '../common/type';
/**
 * @param {Object} loadMdicMapList 数据字典
 * @param {Object} areaListData 地区字典
 * */
const ManageSearchColumns = (loadMdicMapList: Record<string, any>, areaListData: any[]): MaterialManageAPI.IHeaderSearchType => {
  /**物料类型数据字典*/
  const materialTypeMapList = loadMdicMapList?.[`${getTenantID()}${ILoadMapTypeAll.MATERIAL_TYPE}`];
  const searchColumns: MaterialManageAPI.ISearchList = [
    {
      name: 'fullName',
      placeholder: '物料名称',
      label: '物料名称',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'materialType',
      placeholder: '物料类型',
      label: '物料类型',
      componentType: 'TreeSelect',
      dataSource: materialTypeMapList,
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
      treeID: 'id',
      treeName: 'name',
    },
    {
      name: 'specInfo',
      placeholder: '规格要求（参数）',
      label: '规格要求（参数）',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'modelNum',
      placeholder: '规格型号',
      label: '规格型号',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'state',
      placeholder: '物料状态',
      label: '物料状态',
      componentType: 'Select',
      dataSource: [
        { name: '起草', id: '0', value: '0' },
        { name: '审核中', id: '1', value: '1' },
        { name: '有效', id: '2', value: '2' },
        { name: '作废', id: '3', value: '3' },
      ],
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'paramsInfo',
      placeholder: '物料简介',
      label: '物料简介',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },

    /**===============================高级搜素================================*/
    {
      name: 'materialNum',
      placeholder: '物料编码',
      label: '物料编码',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
    },

    {
      name: 'unitPrice',
      placeholder: '参考单价',
      label: '参考单价',
      componentType: 'NumberRange',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
    },
    {
      name: 'cancelTime',
      placeholder: '',
      label: '作废时间',
      componentType: 'RangePicker',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
    },
    {
      name: 'cancelFormName',
      placeholder: '作废',
      label: '作废',
      componentType: 'DeptAndUser',
      dataSource: getLevelZeroJson() ?? [],
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'cancelCompanyID',
        DEPT: 'cancelDepartmentID',
        POS: 'cancelPositionID',
        USER: 'cancelerID',
      },
    },
  ];

  return searchColumns;
};

export { ManageSearchColumns };
